import React from "react"; //创建组件 虚拟DOM 生命周期

//导入CmtList组件样式表
import cssobj from '@/css/cmt.scss'
console.log(cssobj)

//导入bootstrap样式表
import 'bootstrap/dist/css/bootstrap.css'

//导入评论子组件
import CmtItem from '@/components/CmtItem'

//评论父组件
export default class CmtList extends React.Component {
    constructor() {
      super();
      this.status = {
        CommentList: [
          { id: 1, user: "张三", content: "哈哈,沙发" },
          { id: 2, user: "李四", content: "楼上" },
          { id: 3, user: "王五", content: "eeee" },
          { id: 4, user: "赵6", content: "哈哈,傻吊" }
        ]
      };
    }
  
    render() {
      return (
        <div> 
          {/* <h1 style={{color:'red',fontSize:'25px',textAlign:'center'}}>这是评论组件</h1> */}
          <h1 className={cssobj.title}>这是评论组件</h1>
          <button type="button" className="btn btn-primary">button</button>
          {this.status.CommentList.map(item =>
              <CmtItem {...item} key={item.id}></CmtItem> //展开运算符写在标签里
          )}
        </div>
      );
    }
  }